<!DOCTYPE HTML>
<html lang="en" >
    <!-- Start book  -->
    <head>
        <!-- head:start -->
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>变量 | </title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-toggle-chapters/toggle.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-splitter/splitter.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../../md/javascript/string.html" />
    
    
    <link rel="prev" href="../../md/javascript/strict.html" />
    

        <!-- head:end -->
    </head>
    <body>
        <!-- body:start -->
        
    <div class="book"
        data-level="4.2"
        data-chapter-title="变量"
        data-filepath="md/javascript/value.md"
        data-basepath="../.."
        data-revision="Tue Sep 19 2017 14:58:58 GMT+0800 (中国标准时间)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        Introduction
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="md/HTML5/readme.html">
            
                
                    <a href="../../md/HTML5/readme.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        HTML
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="md/HTML5/20170719HTML.html">
            
                
                    <a href="../../md/HTML5/20170719HTML.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        什么是HTML
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="md/HTML5/biaoqian.html">
            
                
                    <a href="../../md/HTML5/biaoqian.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        标签
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="md/HTML5/form.html">
            
                
                    <a href="../../md/HTML5/form.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        表单
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="md/HTML5/form-type.html">
            
                
                    <a href="../../md/HTML5/form-type.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        form标签的类型
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="md/HTML5/20170721HTML.html">
            
                
                    <a href="../../md/HTML5/20170721HTML.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.</b>
                        
                        其他标签的使用
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="md/CSS/readme.html">
            
                
                    <a href="../../md/CSS/readme.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        CSS3
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="md/CSS/20170722CSS.html">
            
                
                    <a href="../../md/CSS/20170722CSS.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        什么是CSS
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="md/CSS/selector.html">
            
                
                    <a href="../../md/CSS/selector.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        选择器
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.2.1" data-path="md/CSS/selector/tongpei.html">
            
                
                    <a href="../../md/CSS/selector/tongpei.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.1.</b>
                        
                        通配选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2.2" data-path="md/CSS/selector/yuansu.html">
            
                
                    <a href="../../md/CSS/selector/yuansu.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.2.</b>
                        
                        元素选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2.3" data-path="md/CSS/selector/qunzu.html">
            
                
                    <a href="../../md/CSS/selector/qunzu.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.3.</b>
                        
                        群组选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2.4" data-path="md/CSS/selector/guanxi.html">
            
                
                    <a href="../../md/CSS/selector/guanxi.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.4.</b>
                        
                        关系选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2.5" data-path="md/CSS/selector/shuxing.html">
            
                
                    <a href="../../md/CSS/selector/shuxing.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.5.</b>
                        
                        属性选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2.6" data-path="md/CSS/selector/weilei.html">
            
                
                    <a href="../../md/CSS/selector/weilei.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.6.</b>
                        
                        伪类选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2.7" data-path="md/CSS/selector/weiduixiang.html">
            
                
                    <a href="../../md/CSS/selector/weiduixiang.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.7.</b>
                        
                        伪对象选择器
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="md/CSS/style/readme.html">
            
                
                    <a href="../../md/CSS/style/readme.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        常用样式分类
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.3.1" data-path="md/CSS/style/font.html">
            
                
                    <a href="../../md/CSS/style/font.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.1.</b>
                        
                        字体样式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.2" data-path="md/CSS/style/box.html">
            
                
                    <a href="../../md/CSS/style/box.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.2.</b>
                        
                        盒子模型
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.3" data-path="md/CSS/style/border.html">
            
                
                    <a href="../../md/CSS/style/border.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.3.</b>
                        
                        边框样式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.4" data-path="md/CSS/style/paragraph.html">
            
                
                    <a href="../../md/CSS/style/paragraph.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.4.</b>
                        
                        段落样式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.5" data-path="md/CSS/style/background.html">
            
                
                    <a href="../../md/CSS/style/background.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.5.</b>
                        
                        背景样式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.6" data-path="md/CSS/style/float.html">
            
                
                    <a href="../../md/CSS/style/float.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.6.</b>
                        
                        浮动
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.7" data-path="md/CSS/style/position.html">
            
                
                    <a href="../../md/CSS/style/position.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.7.</b>
                        
                        定位
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.8" data-path="md/CSS/style/animation.html">
            
                
                    <a href="../../md/CSS/style/animation.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.8.</b>
                        
                        动画及过渡效果
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.9" data-path="md/CSS/style/iconfont.html">
            
                
                    <a href="../../md/CSS/style/iconfont.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.9.</b>
                        
                        外部icon图标库的使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.10" data-path="md/CSS/style/sanjiaoxing.html">
            
                
                    <a href="../../md/CSS/style/sanjiaoxing.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.10.</b>
                        
                        利用border画三角形
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.11" data-path="md/CSS/style/xiaojiao.html">
            
                
                    <a href="../../md/CSS/style/xiaojiao.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.11.</b>
                        
                        对话框旁边的小角制作
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.12" data-path="md/CSS/style/flex.html">
            
                
                    <a href="../../md/CSS/style/flex.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.12.</b>
                        
                        弹性盒子
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="md/CSS/idea/readme.html">
            
                
                    <a href="../../md/CSS/idea/readme.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        小技巧
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.4.1" data-path="md/CSS/idea/caret-color.html">
            
                
                    <a href="../../md/CSS/idea/caret-color.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.1.</b>
                        
                        光标和placeholder颜色
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4.2" data-path="md/CSS/idea/background.html">
            
                
                    <a href="../../md/CSS/idea/background.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.2.</b>
                        
                        部分背景透明
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="md/mobile/readme.html">
            
                
                    <a href="../../md/mobile/readme.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        移动端相关
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" >
            
            <span><b>3.1.</b> [媒体特性与Responsive设计]</span>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="md/mobile/viewport.html">
            
                
                    <a href="../../md/mobile/viewport.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        视口
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="md/mobile/responsive.html">
            
                
                    <a href="../../md/mobile/responsive.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.</b>
                        
                        响应式网页
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" data-path="md/javascript/readme.html">
            
                
                    <a href="../../md/javascript/readme.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        JavaScript
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="md/javascript/strict.html">
            
                
                    <a href="../../md/javascript/strict.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        JavaScript的严格模式
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="4.2" data-path="md/javascript/value.html">
            
                
                    <a href="../../md/javascript/value.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.</b>
                        
                        变量
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3" >
            
            <span><b>4.3.</b> [对象]</span>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.3.1" data-path="md/javascript/string.html">
            
                
                    <a href="../../md/javascript/string.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.1.</b>
                        
                        String
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3.2" data-path="md/javascript/array.html">
            
                
                    <a href="../../md/javascript/array.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.2.</b>
                        
                        Array
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3.3" data-path="md/javascript/date.html">
            
                
                    <a href="../../md/javascript/date.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.3.</b>
                        
                        Date
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3.4" data-path="md/javascript/number.html">
            
                
                    <a href="../../md/javascript/number.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.4.</b>
                        
                        Number
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3.5" data-path="md/javascript/math.html">
            
                
                    <a href="../../md/javascript/math.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.5.</b>
                        
                        Math
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="md/javascript/yunsuanfu.html">
            
                
                    <a href="../../md/javascript/yunsuanfu.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.</b>
                        
                        运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="md/javascript/yuju.html">
            
                
                    <a href="../../md/javascript/yuju.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.5.</b>
                        
                        语句
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.6" data-path="md/javascript/function.html">
            
                
                    <a href="../../md/javascript/function.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.6.</b>
                        
                        函数
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.7" data-path="md/javascript/time.html">
            
                
                    <a href="../../md/javascript/time.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.7.</b>
                        
                        定时器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.8" data-path="md/javascript/dom.html">
            
                
                    <a href="../../md/javascript/dom.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.8.</b>
                        
                        DOM操作
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.8.1" data-path="md/javascript/search.html">
            
                
                    <a href="../../md/javascript/search.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.8.1.</b>
                        
                        查找
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.8.2" data-path="md/javascript/add.html">
            
                
                    <a href="../../md/javascript/add.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.8.2.</b>
                        
                        增加
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.8.3" data-path="md/javascript/remove.html">
            
                
                    <a href="../../md/javascript/remove.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.8.3.</b>
                        
                        移除
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.9" data-path="md/javascript/HTML-JavaScript.html">
            
                
                    <a href="../../md/javascript/HTML-JavaScript.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.9.</b>
                        
                        在HTML中使用JavaScript
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.10" data-path="md/javascript/CSS-javascript.html">
            
                
                    <a href="../../md/javascript/CSS-javascript.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.10.</b>
                        
                        JavaScript控制样式和属性
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.11" data-path="md/javascript/json.html">
            
                
                    <a href="../../md/javascript/json.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.11.</b>
                        
                        JSON相关
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../../" ></a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="&#x53D8;&#x91CF;">&#x53D8;&#x91CF;</h1>
<h2 id="&#x8BED;&#x6CD5;">&#x8BED;&#x6CD5;</h2>
<p>1.&#x53D8;&#x91CF;&#x9996;&#x5B57;&#x7B26;&#x5FC5;&#x987B;&#x4E3A;&#x5B57;&#x6BCD;&#x3001;&#x4E0B;&#x5212;&#x7EBF;_&#x3001;&#x7F8E;&#x5143;&#x7B26;$&#xFF0C;&#x4E09;&#x8005;&#x9009;&#x4E00;&#xFF1B;    </p>
<p>2.&#x533A;&#x5206;&#x5927;&#x5C0F;&#x5199;&#xFF1B;</p>
<p>3.&#x4E0D;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x5173;&#x952E;&#x5B57;&#x548C;&#x4FDD;&#x7559;&#x5B57;;</p>
<p>4.&#x53D8;&#x91CF;&#x540D;&#x6700;&#x597D;&#x5E26;&#x6709;&#x8BED;&#x4E49;&#xFF0C;&#x4E14;&#x547D;&#x540D;&#x89C4;&#x8303;&#x4E5F;&#x53EF;&#x4F7F;&#x7528;&#xFF1A;&#x5C0F;&#x9A7C;&#x5CF0;&#x547D;&#x540D;<code>var shopName;</code>&#xFF0C;&#x5927;&#x9A7C;&#x5CF0;&#x547D;&#x540D;<code>var ShopList;</code>&#xFF1B;</p>
<p>&#x5982;&#x679C;&#x8FDD;&#x53CD;&#x524D;3&#x70B9;&#xFF0C;&#x4F1A;&#x89E6;&#x53D1;SyntaxError&#x8BED;&#x6CD5;&#x9519;&#x8BEF;</p>
<p><strong>&#x7279;&#x6B8A;&#x60C5;&#x51B5;</strong></p>
<pre><code class="lang-javascript">(<span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{
    alert(a);
    alert(b);
    <span class="hljs-keyword">var</span> a=b=<span class="hljs-number">3</span>;
    alert(a);
    alert(b);
})();
<span class="hljs-comment">//&#x76F8;&#x5F53;&#x4E8E; var a=3;b=3; a&#x662F;&#x5C40;&#x90E8;&#x53D8;&#x91CF;&#xFF0C;b&#x662F;&#x5168;&#x5C40;&#x53D8;&#x91CF;</span>
</code></pre>
<h2 id="&#x53D8;&#x91CF;">&#x53D8;&#x91CF;</h2>
<p>&#x53EF;&#x53D8;&#x7684;&#x5BB9;&#x5668;,&#x5982;&#x679C;&#x5B9A;&#x4E49;&#x53D8;&#x91CF;&#x7684;&#x65F6;&#x5019;&#x6CA1;&#x6709;&#x7ED9;&#x521D;&#x59CB;&#x503C;&#xFF0C;&#x9ED8;&#x8BA4;&#x662F;undefined</p>
<p>var &#x53EF;&#x4EE5;&#x5B9A;&#x4E49;&#x53D8;&#x91CF;&#x5BB9;&#x5668;&#xFF0C;&#x540C;&#x65F6;&#x5177;&#x6709;&#x201C;&#x63D0;&#x5347;&#x201D;&#x7684;&#x4F5C;&#x7528;&#xFF0C;&#x5C31;&#x662F;&#x628A;&#x53D8;&#x91CF;&#x7684;&#x5B9A;&#x4E49;&#x5168;&#x90E8;&#x7EDF;&#x4E00;&#x63D0;&#x524D;&#x5230;&#x7A0B;&#x5E8F;&#x7684;&#x6700;&#x5F00;&#x59CB;</p>
<p>let &#x5B9A;&#x4E49;&#x4E00;&#x4E2A;&#x6709;&#x4F5C;&#x7528;&#x57DF;&#x7684;&#x53D8;&#x91CF;&#xFF0C;&#x6CA1;&#x6709;&#x201C;&#x63D0;&#x5347;&#x201D;&#x7684;&#x4F5C;&#x7528;&#x3002;</p>
<pre><code class="lang-javascipt">console.log(ab);        //undefined
var ab = &quot;var&quot;;
console.log(ab);        //&quot;var&quot;
let ab = &quot;let&quot;;            //&#x62A5;&#x9519;&#xFF0C;&#x53D8;&#x91CF;&#x4E0D;&#x80FD;&#x91CD;&#x590D;&#x58F0;&#x660E;&#xFF0C;&#x4E0D;&#x80FD;&#x63D0;&#x5347;&#xFF0C;&#x6709;&#x5757;&#x7EA7;&#x4F5C;&#x7528;&#x57DF;
console.log(ab);
</code></pre>
<h3 id="&#x53D8;&#x91CF;&#x7684;&#x7C7B;&#x578B;">&#x53D8;&#x91CF;&#x7684;&#x7C7B;&#x578B;</h3>
<p>&#x7B80;&#x5355;&#x7C7B;&#x578B;&#x6709;&#xFF1A;&#x5B57;&#x7B26;&#x4E32;&#x3001;&#x6570;&#x503C;&#x3001;&#x5E03;&#x5C14;&#x503C;&#x3001;&#x7A7A;/&#x65E0;<br>&#x590D;&#x6742;&#x7C7B;&#x578B;&#xFF1A;&#x51FD;&#x6570;&#x3001;&#x5BF9;&#x8C61;&#x3001;&#x6570;&#x7EC4;</p>
<h4 id="1&#x5B57;&#x7B26;&#x4E32;&#xFF08;string&#xFF09;">1.&#x5B57;&#x7B26;&#x4E32;&#xFF08;String&#xFF09;</h4>
<p>&#x7279;&#x5F81;&#xFF1A;&#x5F15;&#x53F7;&#x5305;&#x7740;&#x5185;&#x5BB9;&#xFF0C;&#x5355;&#x5F15;&#x53F7;&#x53CC;&#x5F15;&#x53F7;&#xFF08;ES5&#xFF09;&#xFF0C;&#x53CD;&#x5355;&#x5F15;&#x53F7;&#xFF08;ES6&#xFF09;&#xFF0C;</p>
<pre><code class="lang-javascript"><span class="hljs-comment">//&#x8FD4;&#x5355;&#x5F15;&#x53F7;&#xFF0C;&#x4E13;&#x95E8;&#x7528;&#x4E8E;&#x663E;&#x793A;&#x591A;&#x884C;&#x6587;&#x672C;&#xFF0C;&#x4F1A;&#x628A;&#x6574;&#x4E2A;&#x6587;&#x672C;&#x7684;&#x6240;&#x6709;&#x683C;&#x5F0F;&#x5B8C;&#x6574;&#x4FDD;&#x7559;&#x4E0B;&#x6765;&#xFF0C;&#x5982;&#x679C;&#x8981;&#x663E;&#x793A;&#x8FD9;&#x4E9B;&#x7279;&#x6B8A;&#x7684;&#x7B26;&#x53F7;&#xFF0C;&#x9700;&#x8981;&#x7528;&#x4E0A;&#x53CD;&#x659C;&#x6760; \ &#x8868;&#x793A;&#x8F6C;&#x4E49;</span>
<span class="hljs-keyword">var</span> content = <span class="hljs-string">`
    &#x6211;&#x7684;&#x540D;&#x5B57;&#x662F;<span class="hljs-subst">${name}</span>
    &#x54C8;&#x54C8;\$\{\},
    &#x554A;&#x554A;&#x554A;\\, 
    &#x5B89;&#x751F;
`</span>;
</code></pre>
<p><strong>&#x5B57;&#x7B26;&#x4E32;&#x7684;&#x6BD4;&#x8F83;&#x662F;&#x6BCF;&#x4E2A;&#x5B57;&#x7B26;&#x5BF9;&#x4F4D;&#x7684;&#x7F16;&#x7801;&#x6BD4;&#x8F83;</strong></p>
<h4 id="2&#x6570;&#x503C;&#xFF08;number&#xFF09;">2.&#x6570;&#x503C;&#xFF08;Number&#xFF09;</h4>
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Infinity</td>
<td>&#x65E0;&#x9650;&#x5927;</td>
</tr>
<tr>
<td>-Infinity</td>
<td>&#x65E0;&#x9650;&#x5C0F;</td>
</tr>
<tr>
<td>NaN</td>
<td>Not a Number&#xFF0C;NaN&#x4E0E;NaN&#x6BD4;&#x8F83;&#xFF0C;&#x7ED3;&#x679C;&#x662F;false</td>
</tr>
</tbody>
</table>
<p>16&#x8FDB;&#x5236;&#x8868;&#x793A;&#x6570;&#x5B57;</p>
<blockquote>
<ul>
<li>&#x524D;&#x540E;&#x662F;&#x5B57;&#x7B26;&#x4E32;&#x548C;&#x6570;&#x5B57;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x6570;&#x503C;&#x7C7B;&#x578B;&#x7684;&#x53D8;&#x91CF;&#x4F1A;&#x8F6C;&#x5316;&#x4E3A;&#x5B57;&#x7B26;&#x4E32;&#x7C7B;&#x578B;&#x53BB;&#x8FDB;&#x884C;&#x62FC;&#x63A5;&#x5408;&#x5E76;</li>
<li>&#x524D;&#x540E;&#x4E24;&#x8005;&#x90FD;&#x662F;&#x6570;&#x503C;&#xFF0C;&#x5219;&#x8FDB;&#x884C;&#x6570;&#x503C;&#x8FD0;&#x7B97;</li>
</ul>
</blockquote>
<h4 id="3&#x5E03;&#x5C14;&#x503C;&#xFF08;boolean&#xFF09;">3.&#x5E03;&#x5C14;&#x503C;&#xFF08;Boolean&#xFF09;</h4>
<p>&#x53EA;&#x6709;&#x4E24;&#x4E2A;&#x503C;&#xFF0C;true&#x548C;false</p>
<p>&#x5B57;&#x7B26;&#x4E32;&#x4E0E;&#x5E03;&#x5C14;&#x503C;&#x4E4B;&#x95F4;&#x7684;&#x9690;&#x6027;&#x8F6C;&#x6362;&#xFF1A;</p>
<ul>
<li>&#x53EA;&#x8981;&#x5B57;&#x7B26;&#x4E32;&#x5185;&#x7684;&#x5185;&#x5BB9;&#x4E0D;&#x4E3A;&#x7A7A;&#xFF0C;&#x90FD;&#x89C6;&#x4E3A;true</li>
<li>undefined&#x3001;null&#x3001;0&#x3001;-0&#x3001;NaN&#x3001;&quot;&quot;  &#x90FD;&#x4F1A;&#x88AB;&#x8F6C;&#x6362;&#x4E3A;false </li>
</ul>
<h4 id="4&#x7A7A;&#x65E0;&#xFF08;undefinednull&#xFF09;">4.&#x7A7A;/&#x65E0;&#xFF08;undefined/null&#xFF09;</h4>
<ul>
<li>undefined&#x7528;&#x6765;&#x6E05;&#x7A7A;&#x503C;</li>
<li>null&#x7528;&#x6765;&#x9500;&#x6BC1;&#x503C;</li>
</ul>
<p>typeof &#x5224;&#x65AD;&#x53D8;&#x91CF;&#x7C7B;&#x578B;&#x7684;&#x65B9;&#x6CD5;</p>
<h4 id="5&#x5BF9;&#x8C61;&#x7C7B;&#x578B;&#xFF08;object&#xFF09;">5.&#x5BF9;&#x8C61;&#x7C7B;&#x578B;&#xFF08;Object&#xFF09;</h4>
<p>&#x5C5E;&#x6027;&#x952E;&#x503C;&#x7684;&#x96C6;&#x5408;&#xFF0C;&#x8868;&#x793A;&#x5BF9;&#x8C61;&#x5177;&#x6709;&#x4EC0;&#x4E48;&#x6837;&#x7684;&#x5C5E;&#x6027;&#xFF0C;</p>
<p>&#x65B9;&#x6CD5;1&#xFF1A;&#x5148;&#x751F;&#x6210;&#x7A7A;&#x7684;&#x5BF9;&#x8C61;&#xFF0C;&#x7136;&#x540E;&#x518D;&#x7ED9;&#x5177;&#x4F53;&#x7684;&#x5C5E;&#x6027;&#x8D4B;&#x503C;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> Obj = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Object</span>();
Obj.name = <span class="hljs-string">&quot;BGG&quot;</span>;
</code></pre>
<p>&#x65B9;&#x6CD5;2&#xFF1A;&#x751F;&#x6210;&#x5BF9;&#x8C61;&#x7684;&#x540C;&#x65F6;&#xFF0C;&#x628A;&#x5C5E;&#x6027;&#x540D;&#x548C;&#x5C5E;&#x6027;&#x503C;&#x4E00;&#x8D77;&#x5B9A;&#x4E49;&#x8FDB;&#x53BB;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> obj = {
    <span class="hljs-string">&quot;name&quot;</span>:<span class="hljs-string">&quot;bgg&quot;</span>,
    <span class="hljs-string">&quot;age&quot;</span>:<span class="hljs-number">18</span>
};
</code></pre>
<h4 id="6&#x6570;&#x7EC4;&#x7C7B;&#x578B;&#xFF08;array&#xFF09;">6.&#x6570;&#x7EC4;&#x7C7B;&#x578B;&#xFF08;Array&#xFF09;</h4>
<p><strong>&#x6709;&#x5E8F;</strong></p>
<h4 id="7&#x51FD;&#x6570;&#x7C7B;&#x578B;&#xFF08;function&#xFF09;">7.&#x51FD;&#x6570;&#x7C7B;&#x578B;&#xFF08;Function&#xFF09;</h4>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">fun1</span>(<span class="hljs-params">a1</span>)</span>{
    <span class="hljs-built_in">console</span>.log(a1+<span class="hljs-string">&quot;&#x5DF2;&#x7ECF;&#x8D70;&#x8FDB;&#x4E86;fun1&quot;</span>);
};
fun1(Obj.name);
</code></pre>
<h4 id="&#x7B80;&#x5355;&#x7C7B;&#x578B;&#x548C;&#x590D;&#x6742;&#x7C7B;&#x578B;&#x7684;&#x533A;&#x522B;">&#x7B80;&#x5355;&#x7C7B;&#x578B;&#x548C;&#x590D;&#x6742;&#x7C7B;&#x578B;&#x7684;&#x533A;&#x522B;</h4>
<p>&#x590D;&#x6742;&#x7C7B;&#x578B;&#x4E4B;&#x95F4;&#x7684;&#x8D4B;&#x503C;&#xFF0C;&#x662F;&#x628A;&#x5730;&#x5740;&#x62F7;&#x8D1D;&#xFF0C;&#x7528;&#x4E00;&#x6837;&#x7684;&#x5185;&#x5B58;&#x7A7A;&#x95F4;&#xFF0C;&#x6D45;&#x62F7;&#x8D1D;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> obj1 = {
    <span class="hljs-string">&quot;name&quot;</span>:<span class="hljs-string">&quot;bgg&quot;</span>
}
<span class="hljs-keyword">var</span> obj2 = obj1;
<span class="hljs-built_in">console</span>.log(obj1,obj2);
</code></pre>
<p>&#x7B80;&#x5355;&#x7C7B;&#x578B;&#x4E4B;&#x95F4;&#x7684;&#x8D4B;&#x503C;&#xFF0C;&#x7528;&#x81EA;&#x5DF1;&#x7684;&#x5185;&#x5B58;&#x7A7A;&#x95F4;&#x6216;&#x5F00;&#x8F9F;&#x65B0;&#x7684;&#x5185;&#x5B58;&#x7A7A;&#x95F4;&#xFF0C;&#x6DF1;&#x5EA6;&#x62F7;&#x8D1D;</p>
<p>&#x5982;&#x679C;&#x628A;&#x590D;&#x6742;&#x7C7B;&#x578B;&#x8D4B;&#x503C;&#x7ED9;&#x4E00;&#x4E2A;&#x7B80;&#x5355;&#x7C7B;&#x578B;&#xFF0C;&#x4E00;&#x6837;&#x662F;&#x5730;&#x5740;&#x62F7;&#x8D1D;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> room = {
    <span class="hljs-string">&quot;a&quot;</span>:{
        <span class="hljs-string">&quot;a1&quot;</span>: <span class="hljs-number">1</span>;
        <span class="hljs-string">&quot;a2&quot;</span>: <span class="hljs-number">2</span>;
    },
    <span class="hljs-string">&quot;b&quot;</span>:{
        <span class="hljs-string">&quot;b1&quot;</span>: <span class="hljs-number">3</span>;
        <span class="hljs-string">&quot;b2&quot;</span>: <span class="hljs-number">4</span>;
    }
};
<span class="hljs-keyword">var</span> c = <span class="hljs-number">10</span>;
c = room.a;
<span class="hljs-comment">//&#x6B64;&#x5904;&#x8D4B;&#x503C;&#x7684;&#x662F;room.a&#x7684;&#x5730;&#x5740;</span>
</code></pre>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../../md/javascript/strict.html" class="navigation navigation-prev " aria-label="Previous page: JavaScript的严格模式"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../../md/javascript/string.html" class="navigation navigation-next " aria-label="Next page: String"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../../gitbook/app.js"></script>

    
    <script src="../../gitbook/plugins/gitbook-plugin-toggle-chapters/toggle.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-splitter/splitter.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"toggle-chapters":{},"splitter":{},"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}};
    gitbook.start(config);
});
</script>

        <!-- body:end -->
    </body>
    <!-- End of book  -->
</html>
